package com.lcxw.hxzbadmin.dao.adminmapper;

import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import com.lcxw.hxzbadmin.entity.pojo.GiftType;

@Component
@Mapper
public interface GiftTypeMapper {

    @Insert({
        "insert into ywpd_gifttype (`range`, `gifttype`)",
        "values (#{range,jdbcType=INTEGER}, #{gifttype,jdbcType=VARCHAR})"
    })
    int insert(GiftType giftType) throws Exception;

    @Update({
        "update ywpd_gifttype",
        "set `range` = #{range,jdbcType=INTEGER},",
        "`gifttype` = #{gifttype,jdbcType=VARCHAR}",
        "where `id` = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(GiftType giftType) throws Exception;

    @Select("SELECT * FROM ywpd_gifttype WHERE range = #{range}")
    GiftType selectByRange(Integer range) throws Exception;

    @Select("SELECT * FROM ywpd_gifttype")
    List<GiftType> selectAll() throws Exception;
}
